﻿<%@ Page Title="" Language="C#" AutoEventWireup="true" CodeBehind="Sys_Password.aspx.cs" Inherits="Youz.CreditRepay.Manage.Sys_Password" %>

<script>
    

    var requireJS = [
        //"assets/js/jquery.form.js"
    ];
    loadJS(requireJS);
</script>
<div class="row">
    <div class="col-lg-12">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h2><i class="fa fa-edit"></i><%: R(LanguageModule.Sys_AdminInfo, "Sys_AdminInfo", "Sys_AdminInfo") %></h2>
            </div>
            <div class="panel-body">
                <form id="frm" class="form-horizontal" method="post" enctype="multipart/form-data" action="Sys/Handlers/Sys_AdminInfoHandler.ashx?type=ChangePassword">
                  <%--  <input type="hidden" id="IsMemberAccount" value="1" />--%>
                    <div class="form-group">
                        <label class="control-label" for="RoleDesc"><%: R(LanguageModule.Sys_AdminInfo, "MemberAccount", "帐号") %></label>
                        <div class="controls">
                            <input type="text" id="MemberAccount" name="MemberAccount" maxlength="50" readonly="readonly" class="form-control" value="<%= Utility.MemberAccount %>" />
                        </div>
                    </div>
                    <div class="form-group" id="DivLoginPwd">
                        <label class="control-label" for="RoleDesc"><%: R(LanguageModule.Sys_AdminInfo, "PrimitiveLoginPwd", "原始密码") %></label>
                        <div class="controls">
                            <input type="password" id="LoginPwd" name="LoginPwd" maxlength="50" class="form-control" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="RoleDesc"><%: R(LanguageModule.Sys_AdminInfo, "NewLoginPwd", "新密码") %></label>
                        <div class="controls">
                            <input type="password" id="NewLoginPwd" name="NewLoginPwd" maxlength="50" class="form-control" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="RoleDesc"><%: R(LanguageModule.Sys_AdminInfo, "LoginPwd1", "再次输入新密码") %></label>
                        <div class="controls">
                            <input type="password" id="NewLoginPwd1" name="NewLoginPwd1" maxlength="50" class="form-control" />
                        </div>
                    </div>
                    <div class="alert alert-danger" style="display: none;">
                        <button type="button" class="close" data-dismiss="alert">×</button><strong>Oh snap!</strong><span class="content"></span>
                    </div>
                    <div class="form-actions">
                        <button class="btn btn-success" type="submit" id="btnSubmit"><%: R(LanguageModule.M_Common, "btnSubmit", "保存修改") %></button><%-- onclick="retuen validate()"--%>
                        <button class="btn btn-default" type="button" id="btnCancel"><%: R(LanguageModule.M_Common, "btnCancel", "取消") %></button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">

    var flag = false;


    $(function () {
        $("#frm").validate({
            errorElement: "span"
        }
        );
        $("#btnCancel").click(function () {
            window.location.href = 'Default.aspx#Dashboard.aspx';
            location.reload();

        });
        $("#btnSubmit").click(function () {
            var LoginPwd = $("#LoginPwd").val();
            var NewLoginPwd = $("#NewLoginPwd").val();
            var NewLoginPwd1 = $("#NewLoginPwd1").val();
            if (LoginPwd.trim() == "") {
                $(".content").html("<%=R(LanguageModule.M_Common, "ValidatePassword_LoginPwd", "请输入原始密码") %>");
                $(".alert").show();
                return false;
            }
            if (!rePassword.test(NewLoginPwd)) {
                $(".content").html("<%=R(LanguageModule.M_Common, "ValidatePassword_Alert", "密码必须大于6位，且只能为数字，字母，下划线组成") %>");
                $(".alert").show();
                return false;
            }
            if (NewLoginPwd1 != NewLoginPwd) {
                $(".alert > .content").html("<%= R(LanguageModule.M_Common, "ValidatePassword1", "您输入的两次密码不一致，请重新输入") %>");
                $(".alert").show();
                return false;
            }
            $("#frm").ajaxForm({
                dataType: 'json',
                beforeSubmit: function (arr, $form, options) {
                    if (flag) {
                        return false;
                    }
                    else {
                        flag = true;
                        return true;
                    }
                },
                success: function (data) {
                    if (data.isSuccess) {
                        //loadPage("Default.aspx");
                        window.location.href = 'Default.aspx#Dashboard.aspx';
                        location.reload();
                    }
                    else {
                        $(".alert > .content").html(data.message);
                        $(".alert").show();
                    }
                    flag = false;
                }
            });
        });
    });

</script>

